/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Kvest
 */
public class DateUtils 
{
    public static String getCurrentShortTime()
    {
        Date date = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        int m = c.get(Calendar.MINUTE);
        int tmp = m / 60;
        m %= 60;
        int h = (c.get(Calendar.HOUR_OF_DAY) + tmp) % 24;
        
        String t = (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m;
        return t;
    }
    
    public static String getFullDate()
    {
        Date date = new Date();
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        
        int dd = c.get(Calendar.DAY_OF_MONTH);
        int mm = c.get(Calendar.MONTH) + 1;
        int yy = c.get(Calendar.YEAR);
        int s = c.get(Calendar.SECOND);
        
        int m = c.get(Calendar.MINUTE);
        int tmp = m / 60;
        m %= 60;
        int h = (c.get(Calendar.HOUR_OF_DAY) + tmp) % 24;
        
        String result = (dd < 10 ? "0" : "" ) + dd + (mm < 10 ? ".0" : "." ) + mm + "." + yy + " " + 
                        (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + (s < 10 ? ":0" : ":") + s;
        return result;
    }
}
